<%@page import="cn.yunhe.entity.Reply"%>
<%@page import="cn.yunhe.entity.Topic"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/bootstrap.min.css" rel="stylesheet" >
<script type="text/javascript" src ="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src ="js/bootstrap.min.js"></script>
<title>主贴详情</title>
<script>
$(document).ready(function(e) {
	$(".huifu").click(function(e) {
	$("#textArea").toggle();
		});
	});
	var xmlHttp=null;
	function addRplyParent(obj){
	$.ajax({
		url:"ChildernReply",
		type:"Post",
		success:function(result){
			var content=result.getContent();
			var time=result.getCreateTime();
				$("table").append("<tr></tr>");
				var $new_tr=$("table tbody").children().last();
					$new_tr.append("<td>"+content+"</td>");
					$new_tr.append("<td>"+time+"</td>");
					//$new_tr.append("<td>"+item.pwd+"</td>");	
			
		}
	});
	}
</script>
<style type="text/css">
	#reply_head{
		margin-left:250px;
	}
	#title{
		 text-align:center;  
	}
	.option{
		padding-left:672.5px;
		background-color:  	#CDCDB4;
		
	}
	.time{
		background-color:  	#CDCDB4;
	}
	.reply_detail{
		background-color:  	#CDCDB4;
 	}
	#replyArea{
		width:770px;
		height:100px;
	}
	#doc{
		margin-top:50px;
	}
	.t_title{
		padding-left:40px;
		padding-right:40px;
	}
	#topContent, #title,#content,#addReply,#Reply{
		width:800px;
		height:auto;
		margin:0 auto;
	}
	#content{
		margin-top:50px;
		margin-bottom:50px;
		height:100x;
		width:800px;
	}
	#addReply{
		margin-top:50px;
	}
	.hidden{
		width: auto;
		height:auto;
		border: 1px solid red;
		position: absolute;
		right:100px;	
		
	}
	#textArea{
		display: none;
		position: relative;
		right:-200px;
	}
	
</style>
</head>
<body>
<%-- 	<%
		Object obj = request.getAttribute("topic");		
		Topic topic = null;
		if (obj != null) {
			topic = (Topic) obj;
		}
		if (topic != null) {
	%>
	  <div><%=topic.getContent()%></div>
		
	<%
		}
	%> --%>
	<%-- <%Reply reply=null ;%>
	<c:if test="${reply!=null }">
		
		
	</c:if> --%>
	<!-- 顶栏 -->
	<div id="topContent">
		<div id="top-inner">
			<jsp:include page="top.jsp"></jsp:include>
		</div>
	</div>
	<!-- 详细内容 -->
	<div id="doc">
		<!-- 标题 -->
		<div id="title">
			<h3>
				<span class="t_title">
						<span class="bg-primary">${requestScope.topic.title}</span>
				</span>
			</h3>
		</div>
		<!-- 内容 -->
		<div id="content">
			<div id=detail_content class="info">
				<h4 class="modal-title"><span>${requestScope.topic.content}</span></h4>
			</div>
		</div>
		<div id="Reply" class="modal-body">
			<c:forEach items="${requestScope.reply}" var="reply" varStatus="status">
					<div class="reply_content">
						<div id="reply_head" class="info">
								作者:<a>${reply.user.loginName}</a>&nbsp;&nbsp;<span id="time">时间:${reply.createTime}</span>
						</div>
						<div class="reply_detail">
								<div class="reply-text">
									${reply.content}<br><br><br>
								</div>
								<div class="option">							
									<span> ${status.count}楼|<span class="alink_reply"><a class="huifu" >回复</a></span>									
									|<span class="alink_content"><a>举报</a></span></span>															
								</div>
								<table id="addRplyParent">
									
								</table>
								<div  class="hiddenForm">
									<form id=textArea action="ChildernReply">
												<p>Rid:${reply.id}</p>	
										<input type="hidden" value="${topic.id}" name="tid">
										<input type="hidden" value="${reply.id}" name="rid">								
										<textarea rows="2" cols="80" name="content"></textarea>
										<input type="submit" value="提交" class="btn btn-info"  onclick="addRplyParent(this)">
									</form>
								</div>	
						</div>					
					
					</div>
			</c:forEach>
			<div id="addReply">
				<form action="getaddReply" method="post">
					<input type="hidden" value="${requestScope.topic.id}" name="tid">
					<%-- <input type="hidden" value ="${requestScope.reply.ParentId}" name="ParentId"> --%>
						<textarea rows="3" cols="80" id=replyArea name="replyContent"></textarea><br>
						<span class="warning"> 请准守<a>社会主义核心价值观</a>不得违反国家法纪法规,做个有尺度的小朋友!</span>
						<span><input type="submit" class="btn btn-primary" value="回复"></span>
				</form>
			</div>
		</div>
	</div>
</body>
</html>